package com.obsidian.basic.ip.web;


import com.alibaba.fastjson.JSON;
import com.obsidian.basic.ip.ws.ArrayOfString;
import com.obsidian.basic.ip.ws.IpAddressSearchWebServiceSoap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ip_soap")
public class WebServiceController {
    Logger logger = LoggerFactory.getLogger(WebServiceController.class);

    @Autowired
    private IpAddressSearchWebServiceSoap soap;

    @RequestMapping("/{ip}")
    public ArrayOfString searchIp(@PathVariable("ip") String ip) {
        ArrayOfString response = soap.getCountryCityByIp(ip);
        logger.info("项目测试日志：{}",JSON.toJSONString(response));
        return response;
    }


}
